import { v4 as uuidv4 } from "uuid";
//生成随机的字符串，每次执行都不能发生变化，游客身份持久存储
export const getuuid = () => {
  //获取本地的uuid
  let uuid = localStorage.getItem("uuid");
  //判断本地有没有
  if (!uuid) {
    //生成uuid
    uuid = uuidv4();
    //存储到本地
    localStorage.setItem("uuid", uuid);
  }
  return uuid;
};
